//
//  MyScrollView.m
//  王宇先_14_自定义Cell侧滑删除_StoryBoard 应用
//
//  Created by wyx on 16/3/28.
//  Copyright © 2016年 Apon. All rights reserved.
//
#define WIDTH self.bounds.size.width
#define HEIGHT self.bounds.size.height
#import "MyScrollView.h"

@interface MyScrollView ()
@property (nonatomic, retain)UIButton *buttonOfDelete;
@end

@implementation MyScrollView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self config];
    }
    return self;
}
#pragma mark - 配置子视图.
- (void)config{
    self.backgroundColor = [UIColor yellowColor];
    self.contentSize = CGSizeMake(1000, 0);
    self.buttonOfDelete = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    self.buttonOfDelete.backgroundColor = [UIColor redColor];
    self.buttonOfDelete.frame = CGRectMake(WIDTH * 2 - 50, 0, 50, HEIGHT);
    [self.buttonOfDelete setTitle:@"Delete" forState:UIControlStateNormal];
    [self.buttonOfDelete addTarget:self action:@selector(handleAction:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:self.buttonOfDelete];
    
    
}
-(void)handleAction:(UIButton *)button {
    if ([self.delegate1 respondsToSelector:@selector(buttonDidTouched)]) {
        [self.delegate1 buttonDidTouched];
    }
}
@end
